package com.gree.flowable.app.tools.pattern;

import com.gree.flowable.app.pojo.ex.FlowElementEx;
import com.gree.flowable.app.pojo.vo.NextElementVO;
import org.flowable.bpmn.model.FlowElement;

import java.util.ArrayList;
import java.util.List;

public class ChooseStrategy implements AllotNodeVoStrategy<List<FlowElementEx>> {
    @Override
    public List<NextElementVO> pack(List<FlowElementEx> data) {
        List<NextElementVO> list = new ArrayList<>();
        if (data == null){
            return list;
        }
        data.forEach(vo->{
            NextElementVO node = new NextElementVO();
            FlowElement flowElement = vo.getFlowElement();
            node.setName(flowElement.getName());
            node.setElementId(flowElement.getId());
            node.setDocumentation(flowElement.getDocumentation());
            node.setFlowName(vo.getFlowName());
            node.setExcutionType(vo.getExcutionType());
            list.add(node);
        });
        return list;
    }
}
